#pragma once

//#include "common.h"
#include <cutil.h>
#include <cuda_runtime.h>
#include <cutil_inline.h>

#define CUDA_MAX_THREAD 512

__global__ void RunHaarCascadeClassifier(float *d_sum, float *d_sqsum, float *factors, 
                                         int *d_classifier_rect0_x, int *d_classifier_rect0_y, int *d_classifier_rect0_width, int *d_classifier_rect0_height, float *d_classifier_rect0_weight, 
                                         int *d_classifier_rect1_x, int *d_classifier_rect1_y, int *d_classifier_rect1_width, int *d_classifier_rect1_height, float *d_classifier_rect1_weight, 
                                         int *d_classifier_rect2_x, int *d_classifier_rect2_y, int *d_classifier_rect2_width, int *d_classifier_rect2_height, float *d_classifier_rect2_weight, 
                                         float *d_classifier_alpha0, float *d_classifier_alpha1, float *d_classifier_threshold, 
                                         float *d_stage_threshold, int *d_stage_count,
                                         float *classifier_weight_scale, int *d_step, int *d_real_win_size_width, int *d_real_win_size_height, 
                                         char *d_result, int *d_debug_msg, float *d_float_debug_msg1);

void GPUIntegralImage(unsigned char* h_image,float* h_sum,float* h_sqsum, int width, int height, int image_width_step, int sum_width_step);


void FaceDetectionGPUCore(int img_cols, int img_rows, int img_width_step, int sum_width, int sum_height, int sum_width_step, 
                          int cascade_origin_window_size_width, int cascade_origin_window_size_height, 
                          float scale_factor, int cascade_count, int max_stage_count, 
                          unsigned char *image_data, float *sum, float *sqsum, int *stage_count, float *stage_threshold,
                          int *classifier_rect0_x, int *classifier_rect0_y, int *classifier_rect0_width, int *classifier_rect0_height, float *classifier_rect0_weight, 
                          int *classifier_rect1_x, int *classifier_rect1_y, int *classifier_rect1_width, int *classifier_rect1_height, float *classifier_rect1_weight, 
                          int *classifier_rect2_x, int *classifier_rect2_y, int *classifier_rect2_width, int *classifier_rect2_height, float *classifier_rect2_weight, 
                          float *classifier_alpha0, float *classifier_alpha1, float *classifier_threshold);
